package com.pro.common.user.task.fallback;

import com.pro.common.api.user.task.intf.UserTaskFeignClient;
import com.pro.common.api.user.task.model.db.UserTask;
import com.pro.common.api.user.task.model.request.UserTaskCreatRequest;
import com.pro.common.api.user.task.model.request.UserTaskStepSubmitRequest;
import com.pro.common.user.task.service.UserTaskService;
import com.pro.common.user.task.service.UserTaskUnitService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/")
@AllArgsConstructor
@Slf4j
public class UserTaskFeignFallback implements UserTaskFeignClient {

    private UserTaskUnitService userTaskUnitService;
    private UserTaskService userTaskService;

    @Override
    public List<UserTask> listByIds(List<Long> ids) {
        return userTaskService.listByIds(ids);
    }

    @Override
    public void create(List<UserTaskCreatRequest> tasks) {
        userTaskUnitService.create(tasks);
    }

    @Override
    public void submitStepsNotify(List<UserTaskStepSubmitRequest> steps) {
        userTaskUnitService.submitStepsNotify(steps);
    }
}

